print ("Введите скобочную последовательность:")
t = input()
t1 = ''
for char in t:
    if char == '(':
        t1 += char

    if char == ')':
        if len(t1)>0:
            if t1[len(t1) -1] == '(':
                t1 = t1[: -1]

    if char == '[':
        t1 += char

    if char == ']':
        if len(t1)>0:
            if t1[len(t1) -1] == '[':
                t1 = t1[: -1]
    if char == '{':
        t1 += char

    if char == '}':
        if len(t1)>0:
            if t1[len(t1) -1] == '{':
                t1 = t1[: -1]
    if char == '<':
        t1 += char

    if char == '>':
        if len(t1)>0:
            if t1[len(t1) -1] == '<':
                t1 = t1[: -1]
    print(t1)

if len(t1) == 0:
    print("True")
else:
    print("False")
    

